<?php

namespace App\Models\Admin;

use App\Models\BaseModel;

class TotalBonusPool extends BaseModel
{
    protected $fillable = [
        'id', 'store_id', 'bonus_pool_one_sum',
        'team_month_sum', 'team_year_sum',
        'team_recommend', 'team_fund',
        'created_at', 'updated_at'
    ];

    public function getBonusType($key)
    {
        $str = [];
        switch ($key) {
            case 1:
                $str['reason']= '虹包';
                $str['type']= 1;
                $str['deal_type']= 21;  //订单支付后 收入
                $str['field']= 'bonus_pool_one_sum';//totalbounspools表的字段表
                $str['in']= [21,30];    //增的类型
                $str['out']= [26,36];   //扣的类型
                $str['transfer_in_type']= ''; //转入的类型 一般转入教育基金 和 余额 其他一般作为转出方
                $str['transfer_out_type']= 36; //剩余奖金转出的交易类型
                $str['transfer_out_reason']= '虹包剩余金额转出';//剩余金额转出描述
                $str['transfer_to_id']= 5;//剩余奖金转入哪里 1号奖金池剩余奖金转入教育基金
                break;
            case 2:
                $str['reason']= '报单奖励';
                $str['type']= 2;
                $str['deal_type']= 22;
                $str['field']= 'team_month_sum';
                $str['in']= [22];
                $str['out']= [27,37];
                $str['transfer_in_type']= '';
                $str['transfer_out_type']= 37;
                $str['transfer_out_reason']= '报单奖励剩余金额转出';
                $str['transfer_to_id']= 5;
                break;
            case 3:
                $str['reason']= '分虹';
                $str['type']= 3;
                $str['deal_type']= 23;
                $str['field']= 'team_year_sum';
                $str['in']= [23];
                $str['out']= [28,38];
                $str['transfer_in_type']= '';
                $str['transfer_out_type']= 38;
                $str['transfer_out_reason']= '分虹剩余金额转出';
                $str['transfer_to_id']= 5;
                break;
            case 4:
                $str['reason']= '招商奖励';
                $str['type']= 4;
                $str['deal_type']= 24;
                $str['field']= 'team_recommend_sum';
                $str['in']= [24];
                $str['out']= [29,39];
                $str['transfer_in_type']= '';
                $str['transfer_out_type']= 39;
                $str['transfer_out_reason']= '招商奖励剩余金额转出';
                $str['transfer_to_id']= 5;
                break;
            case 5:
                $str['reason']= '教育培训基金';
                $str['type']= 5;
                $str['deal_type']= 25;
                $str['field']= 'team_fund_sum';
                $str['in']= [25,40];
                $str['out']= [35];
                $str['transfer_in_type']= 40;
                $str['transfer_out_type']= 35;
                $str['transfer_out_reason']= '教育培训基金金额转出';
                $str['transfer_to_id']= 5;
                break;         
            default:
                # code...
                break;
        }
        return $str;
    }
}
